package com.itheima.reggie.common;

import com.sun.org.apache.bcel.internal.generic.LSUB;

/**
 * @author: 爱学Java 不想秃头的 KK
 * @date: 2023/7/26 15:31
 * @version: 1.0
 * @Created with IntelliJ IDEA.
 * @Description:
 */


/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户的id
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    public static Long getCurrentId() {
        return threadLocal.get();
    }
}
